package com.example.demo.util;


public class StringUtil {
    public static String path = "<!DOCTYPE html>\n" +
            "<html>\n" +
            "<head>\n" +
            "    <meta charset=\"utf-8\"/>\n" +
            "    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">\n" +
            "    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">\n" +
            "    <title>管理</title>\n" +
            "    <link rel=\"stylesheet\" href=\"../../assets/libs/layui/css/layui.css\"/>\n" +
            "    <link rel=\"stylesheet\" href=\"../../assets/module/admin.css?v=315\"/>\n" +
            "    <!--[if lt IE 9]>\n" +
            "    <script src=\"https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js\"></script>\n" +
            "    <script src=\"https://oss.maxcdn.com/respond/1.4.2/respond.min.js\"></script>\n" +
            "    <![endif]-->\n" +
            "</head>\n" +
            "<body>\n" +
            "\n" +
            "<!-- 页面加载loading -->\n" +
            "<div class=\"page-loading\">\n" +
            "    <div class=\"ball-loader\">\n" +
            "        <span></span><span></span><span></span><span></span>\n" +
            "    </div>\n" +
            "</div>\n" +
            "\n" +
            "<!-- 正文开始 -->\n" +
            "<div class=\"layui-fluid\">\n" +
            "    <div class=\"layui-card\">\n" +
            "        <div class=\"layui-card-body table-tool-mini full-table\">\n" +
            "            <div class=\"layui-form toolbar\">\n" +
            "                <div class=\"layui-form-item\">\n" +
            "                    <div class=\"layui-inline\">\n" +
            "                        <label class=\"layui-form-label w-auto\">产品列表：</label>\n" +
            "                        <div class=\"layui-input-inline mr0\">\n" +
            "                            <input name=\"name\" class=\"layui-input\" type=\"text\" placeholder=\"输入产品名\"/>\n" +
            "                        </div>\n" +
            "                    </div>\n" +
            "                    <div class=\"layui-inline\" style=\"padding-right: 110px;\">\n" +
            "                        <button class=\"layui-btn icon-btn\" lay-filter=\"formSubSearchBook\" lay-submit>\n" +
            "                            <i class=\"layui-icon\">&#xe615;</i>搜索\n" +
            "                        </button>\n" +
            "                        <button id=\"btnAddBook\" class=\"layui-btn icon-btn\"><i class=\"layui-icon\">&#xe654;</i>添加</button>\n" +
            "                    </div>\n" +
            "                </div>\n" +
            "            </div>\n" +
            "\n" +
            "            <table class=\"layui-table\" id=\"tableBook\" lay-filter=\"tableBook\"></table>\n" +
            "        </div>\n" +
            "    </div>\n" +
            "</div>\n" +
            "\n" +
            "<!-- 表格操作列 -->\n" +
            "<script type=\"text/html\" id=\"tableBarBook\">\n" +
            "    <a class=\"layui-btn layui-btn-primary layui-btn-xs\" lay-event=\"edit\">修改</a>\n" +
            "    <a class=\"layui-btn layui-btn-danger layui-btn-xs\" lay-event=\"del\">删除</a>\n" +
            "</script>\n" +
            "\n" +
            "<!-- 表单弹窗 -->\n" +
            "<script type=\"text/html\" id=\"modelBook\">\n" +
            "    <form id=\"modelBookForm\" lay-filter=\"modelBookForm\" class=\"layui-form model-form\">\n" +
            "        <input name=\"id\" type=\"hidden\"/>\n" +
            "        <div class=\"layui-form-item\">\n" +
            "            <label class=\"layui-form-label\">产品名称</label>\n" +
            "            <div class=\"layui-input-block\">\n" +
            "                <input name=\"name\" placeholder=\"请输入产品名\" type=\"text\" class=\"layui-input\" maxlength=\"20\"\n" +
            "                       lay-verType=\"tips\" lay-verify=\"required\" required/>\n" +
            "            </div>\n" +
            "        </div>\n" +
            "        <div class=\"layui-form-item\">\n" +
            "            <label class=\"layui-form-label\">产品内容</label>\n" +
            "            <div class=\"layui-input-block\">\n" +
            "                <input name=\"description\" placeholder=\"请输入产品简介\" type=\"text\" class=\"layui-input\" maxlength=\"20\"\n" +
            "                       lay-verType=\"tips\" lay-verify=\"required\" required/>\n" +
            "            </div>\n" +
            "        </div>\n" +
            "        <div class=\"layui-form-item\">\n" +
            "            <label class=\"layui-form-label\">产品单价</label>\n" +
            "            <div class=\"layui-input-block\">\n" +
            "                <input name=\"unit_price\" placeholder=\"请输入产品单价\" type=\"text\" class=\"layui-input\" maxlength=\"20\"\n" +
            "                       lay-verType=\"tips\" lay-verify=\"required\" required/>\n" +
            "            </div>\n" +
            "        </div>\n" +
            "        <div class=\"layui-form-item text-right\">\n" +
            "            <button class=\"layui-btn layui-btn-primary\" type=\"button\" ew-event=\"closePageDialog\">取消</button>\n" +
            "            <button class=\"layui-btn\" lay-filter=\"modelSubmitBook\" lay-submit>保存</button>\n" +
            "        </div>\n" +
            "    </form>\n" +
            "</script>\n" +
            "\n" +
            "<!--<script type=\"text/html\" id=\"building_2\">-->\n" +
            "<!--    <input type=\"checkbox\" lay-filter=\"ckStateUser\" value=\"{{d.status}}\" lay-skin=\"switch\" disabled-->\n" +
            "<!--           lay-text=\"已发布|未发布\" {{d.status==0?'checked':''}}/>-->\n" +
            "<!--</script>-->\n" +
            "<script type=\"text/html\" id=\"templet_create\">\n" +
            "    {{d.create_admin.username}}\n" +
            "</script>\n" +
            "<script type=\"text/html\" id=\"templet_update\">\n" +
            "    {{d.update_admin==null?d.update_admin.username:'无'}}\n" +
            "</script>\n" +
            "<!-- js部分 -->\n" +
            "<script type=\"text/javascript\" src=\"../../assets/libs/layui/layui.js\"></script>\n" +
            "<script type=\"text/javascript\" src=\"../../assets/js/common.js?v=315\"></script>\n" +
            "<script>\n" +
            "    layui.use(['layer', 'form', 'table', 'util', 'admin', 'tableX'], function () {\n" +
            "        var $ = layui.jquery;\n" +
            "        var layer = layui.layer;\n" +
            "        var form = layui.form;\n" +
            "        var table = layui.table;\n" +
            "        var util = layui.util;\n" +
            "        var admin = layui.admin;\n" +
            "        var tableX = layui.tableX;\n" +
            "\n" +
            "        // 渲染表格\n" +
            "        var insTb = table.render({\n" +
            "            elem: '#tableBook',\n" +
            "            url: '/api/getAllProducts',\n" +
            "            page: true,\n" +
            "            height: \"full-100\",\n" +
            "            toolbar: true,\n" +
            "            cellMinWidth: 100,\n" +
            "            cols: [\n" +
            "                [\n" +
            "                    {field: 'id', title: 'id'}\n" +
            "                    ,{field: 'name', sort: true, title: '产品名称'}\n" +
            "                    ,{field: 'description', sort: true, title: '产品简介'}\n" +
            "                    ,{field: 'unit_price', sort: true, title: '单价'}\n" +
            "                    ,{field: 'stock_quantity', sort: true, title: '库存'}\n" +
            "                ]\n" +
            "            ]\n" +
            "        });\n" +
            "\n" +
            "        // 添加\n" +
            "        $('#btnAddBook').click(function () {\n" +
            "            showEditModel();\n" +
            "        });\n" +
            "\n" +
            "        // 搜索\n" +
            "        form.on('submit(formSubSearchBook)', function (data) {\n" +
            "            insTb.reload({where: data.field,url:'/api/findProductByName',page : {curr : 1}}, 'data');\n" +
            "        });\n" +
            "\n" +
            "        // 工具条点击事件\n" +
            "        table.on('tool(tableBook)', function (obj) {\n" +
            "            var data = obj.data;\n" +
            "            var layEvent = obj.event;\n" +
            "            if (layEvent === 'edit') { // 修改\n" +
            "                showEditModel(data);\n" +
            "            } else if (layEvent === 'del') { // 删除\n" +
            "                doDel(data.id, data.title);\n" +
            "            }\n" +
            "        });\n" +
            "\n" +
            "        // 显示表单弹窗\n" +
            "        function showEditModel(mBook) {\n" +
            "            if(mBook==null){\n" +
            "                admin.open({\n" +
            "                    type: 1,\n" +
            "                    title: '添加产品',\n" +
            "                    content: $('#modelBook').html(),\n" +
            "                    success: function (layero, dIndex) {\n" +
            "                        $(layero).children('.layui-layer-content').css('overflow', 'visible');\n" +
            "                        var url = '/api/addProduct';\n" +
            "                        // 回显数据\n" +
            "                        form.val('modelBookForm', mBook);\n" +
            "                        // 表单提交事件\n" +
            "                        form.on('submit(modelSubmitBook)', function (data) {\n" +
            "                            layer.load(2);\n" +
            "                            $.ajax({\n" +
            "                                url:url,\n" +
            "                                type:\"POST\",\n" +
            "                                data:JSON.stringify(data.field),\n" +
            "                                contentType:\"application/json; charset=utf-8\",\n" +
            "                                dataType:\"json\",\n" +
            "                                success: function(res){\n" +
            "                                    layer.closeAll('loading');\n" +
            "                                    if (res.code == 200) {\n" +
            "                                        layer.close(dIndex);\n" +
            "                                        layer.msg(res.msg, {icon: 1});\n" +
            "                                        insTb.reload({}, 'data');\n" +
            "                                    } else {\n" +
            "                                        layer.msg(res.msg, {icon: 2});\n" +
            "                                    }\n" +
            "                                }\n" +
            "                            })\n" +
            "                            return false;\n" +
            "                        });\n" +
            "                    }\n" +
            "                });\n" +
            "            }else{\n" +
            "                admin.open({\n" +
            "                    type: 1,\n" +
            "                    title: '修改产品',\n" +
            "                    content: $('#modelBook').html(),\n" +
            "                    success: function (layero, dIndex) {\n" +
            "                        $(layero).children('.layui-layer-content').css('overflow', 'visible');\n" +
            "                        var url = '/api/updateProduct';\n" +
            "                        // 回显数据\n" +
            "                        form.val('modelBookForm', mBook);\n" +
            "                        // 表单提交事件\n" +
            "                        form.on('submit(modelSubmitBook)', function (data) {\n" +
            "                            layer.load(2);\n" +
            "                            $.ajax({\n" +
            "                                url:url,\n" +
            "                                type:\"POST\",\n" +
            "                                data:JSON.stringify(data.field),\n" +
            "                                contentType:\"application/json; charset=utf-8\",\n" +
            "                                dataType:\"json\",\n" +
            "                                success: function(res){\n" +
            "                                    layer.closeAll('loading');\n" +
            "                                    if (res.code == 200) {\n" +
            "                                        layer.close(dIndex);\n" +
            "                                        layer.msg(res.msg, {icon: 1});\n" +
            "                                        insTb.reload({}, 'data');\n" +
            "                                    } else {\n" +
            "                                        layer.msg(res.msg, {icon: 2});\n" +
            "                                    }\n" +
            "                                }\n" +
            "                            })\n" +
            "                            return false;\n" +
            "                        });\n" +
            "                    }\n" +
            "                });\n" +
            "            }\n" +
            "\n" +
            "        }\n" +
            "\n" +
            "        // 删除\n" +
            "        function doDel(id, name) {\n" +
            "            layer.confirm('确定要删除“' + name + '”吗？', {\n" +
            "                skin: 'layui-layer-admin',\n" +
            "                shade: .1\n" +
            "            }, function (i) {\n" +
            "                layer.close(i);\n" +
            "                layer.load(2);\n" +
            "                $.get('/api/delProduct', {\n" +
            "                    id: id\n" +
            "                }, function (res) {\n" +
            "                    layer.closeAll('loading');\n" +
            "                    if (res.code == 200) {\n" +
            "                        layer.msg(res.msg, {icon: 1});\n" +
            "                        insTb.reload({}, 'data');\n" +
            "                    } else {\n" +
            "                        layer.msg(res.msg, {icon: 2});\n" +
            "                    }\n" +
            "                }, 'json');\n" +
            "            });\n" +
            "        }\n" +
            "\n" +
            "\n" +
            "    });\n" +
            "</script>\n" +
            "\n" +
            "</body>\n" +
            "</html>";
}
